package com.wondertek.service.service.business.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wondertek.service.entity.business.UserSitePo;
import com.wondertek.service.mapper.business.UserSiteMapper;
import com.wondertek.service.service.business.UserSiteService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: qinjianhui
 * @create: 2024-07-17 17:52
 **/
@Service
public class UserSiteServiceImpl extends ServiceImpl<UserSiteMapper, UserSitePo> implements UserSiteService {

    /*
    * 批量新增
    * */
    @Override
    public void insertBatch(String userId, List<String> siteIds) {
        List<UserSitePo> list = new ArrayList<>();
        for(String siteId : siteIds){
            UserSitePo po = new UserSitePo();
            po.setSiteId(siteId);
            po.setUserId(userId);
            list.add(po);
        }
        this.saveBatch(list);
    }
}

